package com.ceuer.demo.state;

public class PriorityTest {
	public static void main(String[] args) {
		//主线程默认优先级
		System.out.println(Thread.currentThread().getName()+"--->"+Thread.currentThread().getPriority());
		
		PriorityTest priorityTest=new PriorityTest();
		
		Priority priority=new Priority();
		Thread t1=new Thread(priority);
		Thread t2=new Thread(priority);
		Thread t3=new Thread(priority);
		Thread t4=new Thread(priority);
		Thread t5=new Thread(priority);
		Thread t6=new Thread(priority);
		
		t1.start();//先设置默认优先级
		
		t2.setPriority(1);
		t2.start();
		
		t3.setPriority(4);
		t3.start();
		
		t4.setPriority(Thread.MAX_PRIORITY);
		t4.start();
		
		t5.setPriority(8);
		t5.start();

		t6.setPriority(7);
		t6.start();
	}
}

class Priority implements Runnable{
	@Override
	public void run() {
		System.out.println(Thread.currentThread().getName()+"--->"+Thread.currentThread().getPriority());
	}
}